package com.mf.service.impl;

import com.mf.config.RabbitMqConfig;
import com.mf.service.RabbitMqService;
import io.github.heollhai.common.entity.request.SocketMessageRequest;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.stereotype.Service;

/**
 * @Author: lmf
 * @Create: 2024/11/26 21:15
 * Description:  mq消息发送
 */
@Service
@Slf4j
public class RabbitMqServiceImpl implements RabbitMqService {
    @Resource
    private RabbitTemplate rabbitTemplate;

    @Override
    public void sendMessage(String exchange, String routingKey, SocketMessageRequest message) {
        rabbitTemplate.convertAndSend(RabbitMqConfig.EXCHANGE_NAME, routingKey, message);
    }
}
